# -*- coding:utf-8 -*-

import smtplib
from email.mime.text import MIMEText
from email.header import Header

# 第三方 SMTP 服务
mail_host = "smtp.exmail.qq.com"  # 设置服务器
mail_user = "lei.xie@marketingforce.com"  # 用户名
mail_pass = "8273kjAKIUHnedweiu542171827TGYTU"  # 密码

sender = 'lei.xie@marketingforce.com'
receivers = ['17782384897@163.com']  # 接收邮件，可设置为你的QQ邮箱或者其他邮箱

# 三个参数：第一个为文本内容，第二个 plain 设置文本格式，第三个 utf-8 设置编码
message = MIMEText('Python 邮件发送123...', 'plain', 'utf-8')
# message['From'] = Header("发送人头部信息", 'utf-8')  # 发送者
# message['To'] = Header("收件人头部信息", 'utf-8')  # 接收者

subject = '服务器拉取成功！！时间：'
message['Subject'] = Header(subject, 'utf-8')

smtpObj = smtplib.SMTP_SSL(mail_host)
smtpObj.connect(mail_host, 465)
smtpObj.login(mail_user, mail_pass)
smtpObj.sendmail(sender, receivers, message.as_string())
